set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_BUILD_TYPE "Release")


set(DEL "del")
set(ARM_TOOLS "C:/ARM/Program\ Files/DS-5\ v5.26.0/sw/ARMCompiler5.06u4/bin")
set(CMAKE_FIND_ROOT_PATH "C:/ARM/Program\ Files/DS-5\ v5.26.0/sw/ARMCompiler5.06u4")
set(CMAKE_SYSROOT "C:/ARM/Program\ Files/DS-5\ v5.26.0/sw/ARMCompiler5.06u4")
set(CMAKE_ASM_COMPILER "${ARM_TOOLS}/armasm.exe")
set(CMAKE_AR "${ARM_TOOLS}/armar.exe")
set(CMAKE_LINKER "${ARM_TOOLS}/armlink.exe")
set(CMAKE_C_COMPILER "${ARM_TOOLS}/armcc.exe")
set(CMAKE_C_COMPILER_ID "ARMCC")

option(USING_EXTERNAL_OPUS "using external opus lib" ON)

# set(CMAKE_C_FLAGS_INIT "--cpu cortex-a5 -O3 --apcs /interwork/ --fpu VFPv2 --enum_is_int -D_RTOS -D_DEBUG --loose_implicit_cast  --debug --no_unaligned_access")
# set(CMAKE_ASM_FLAGS_INIT "--cpu cortex-a5 --apcs /interwork")
set(CMAKE_C_FLAGS_INIT "--cpu=cortex-r5 -g --thumb --apcs=/interwork -O3 -Ospace --fpu=softvfp --littleend --c99")
#set(CMAKE_C_FLAGS_INIT "--cpu Cortex-R4 -g --thumb --apcs=/interwork -O3 -Ospace --fpu=softvfp --littleend --c99")

set (CMAKE_STATIC_LIBRARY_SUFFIX_C ".a")
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

if(${CMAKE_BUILD_TYPE} EQUAL "Debug")
    set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} -g")
    set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} -g")
endif()

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
